package client.gui.roombox;

import junit.framework.Assert;
import listener.Listener;

import org.junit.Test;

import stalker.Stalker;
import broadcaster.Broadcaster;
import data.Data;
import data.content.ContentSentence;


public class RoomBoxModelTest {
  
  private int cnt = 0;
  
  private class DummyListener implements Listener {
    public void respond(Broadcaster b) {
      ++cnt;
    }
  };
  
  @Test
  public void test01() {
    cnt = 0;
    RoomBoxModel model = new RoomBoxModel(Stalker.GUEST_STALKER);
    DummyListener dumlist1 = new DummyListener();
    DummyListener dumlist2 = new DummyListener();
    model.addListener(dumlist1);
    model.addListener(dumlist2);
    
    Stalker g = Stalker.GUEST_STALKER;
    
    model.assignStalkerToRoom(g);
    model.removeStalkerFromRoom(g);
    model.addData(new Data(g, new ContentSentence("Ten")));
    
    Assert.assertTrue(model.dataSize() == 1);
    Assert.assertTrue(model.getDataAt(0).equals(new Data(g, new ContentSentence("Ten"))));
    
    
    Assert.assertTrue(cnt == 6);
  }
  
}
